﻿using Authentication.Model.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Authentication.Provider
{
    public class ProviderFactory : IProviderFactory
    {
        private IUserProvider users = null;
        public IUserProvider Users
        {
            get
            {
                if (users == null) users = new AccountProvider();
                return users;
            }
        }

        private IRequestDaoProvider requestDao = null;
        public IRequestDaoProvider RequestDao
        {
            get
            {
                if (requestDao == null) requestDao = new RequestDaoProvider();
                return requestDao;
            }
        }

        private IChangeDaoProvider changeDao= null;
        public IChangeDaoProvider ChangeDao
        {
            get
            {
                if (changeDao == null) changeDao = new ChangeDaoProvider();
                return changeDao;
            }
        }


        private ICloseDaoProvider closeDao = null;
        public ICloseDaoProvider CloseDao
        {
            get
            {
                if (closeDao == null) closeDao = new CloseDaoProvider();
                return closeDao;
            }
        }


        private ICustomerProvider customer = null;
        public ICustomerProvider Customer
        {
            get
            {
                if (customer == null) customer = new CustomerProvider();
                return customer;
            }
        }
        private IAccountGroupCustomerProvider accountGroupCustomer = null;
        public IAccountGroupCustomerProvider AccountGroupCustomers
        {
            get
            {
                if (accountGroupCustomer == null) accountGroupCustomer = new AccountGroupCustomerProvider();
                return accountGroupCustomer;
            }
        }

        private IObjectProvider objects = null;
        public IObjectProvider Objects
        {
            get
            {
                if (objects == null) objects = new ObjectProvider();
                return objects;
            }
        }
        private IGroupRoleProvider groupRole = null;
        public IGroupRoleProvider GroupRole
        {
            get
            {
                if (groupRole == null) groupRole = new GroupRoleProvider();
                return groupRole;
            }
        }

        public IUserRoleProvider userRole = null;
        public IUserRoleProvider UserRole
        {
            get
            {
                if (userRole == null) userRole = new AccountRoleProvider();
                return userRole;
            }
        }

        private IConfigurationProvider configurations = null;
        public IConfigurationProvider Configurations
        {
            get
            {
                if (configurations == null) configurations = new ConfigurationProvider();
                return configurations;
            }
        }

        private ISaleCodeProvider saleCode = null;
        public ISaleCodeProvider SaleCode
        {
            get
            {
                if (saleCode == null) saleCode = new SaleCodeProvider();
                return saleCode;
            }
        }
        private IEditDaoProvider editDao = null;
        public IEditDaoProvider EditDao
        {
            get
            {
                if (editDao == null) editDao = new EditDaoProvider();
                return editDao;
            }
        }
        private IBranchProvider branch = null;
        public IBranchProvider Branch
        {
            get
            {
                if (branch == null) branch = new BranchProvider();
                return branch;
            }
        }
    }
}
